package com.ayuku.retail.ui.supplier;

import java.util.logging.Logger;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.SWTResourceManager;

import com.ayuku.commons.AyBigDecimal;
import com.ayuku.commons.Util;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.GridData;

/**
 * 
 * @author putu kusuma <putukn@gmail.com>
 * 
 */
public class CompSupplier extends org.eclipse.swt.widgets.Composite {

	protected Text txName;
	protected Text txtAlamat;
	protected Text txtPhone;
	protected Text txtCode;
	private Label label10;
	private Label label9;
	private Label label8;
	protected Text txtFax;
	private Label label11;
	protected Text txtKontakPerson;
	private Label label13;
	protected Text txtCatatan;
	protected Text txtAccName;
	protected Text txtAccNo;
	protected Text txtBankName;
	protected AyBigDecimal txtSaldoHutang;
	private Label label12;
	protected Text txtWebsite;
	protected Text txtEmail;
	private Label label7;
	private Label label5;
	private static Logger LOG = Logger.getLogger(CompSupplier.class.getName());

	public CompSupplier(final org.eclipse.swt.widgets.Composite parent,
			final int style) {
		super(parent, style);
		initGUI();
	}

	private void initGUI() {
		try {

			this.setBackground(SWTResourceManager.getColor(215, 213, 253));
			setLayout(new GridLayout(2, false));

			final Label label1 = new Label(this, SWT.NONE);
			label1.setText("Kode Supplier:");
			label1.setAlignment(SWT.RIGHT);

			label1.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label1.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));
			txtCode = new Text(this, SWT.BORDER);
			GridData gd_txtCode = new GridData(SWT.LEFT, SWT.CENTER, true,
					false, 1, 1);
			gd_txtCode.widthHint = 249;
			txtCode.setLayoutData(gd_txtCode);
			txtCode.setTextLimit(14);

			txtCode.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			final Label label2 = new Label(this, SWT.NONE);
			label2.setText("Nama Supplier:");
			label2.setAlignment(SWT.RIGHT);

			label2.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label2.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txName = new Text(this, SWT.BORDER);
			txName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1));
			txName.setTextLimit(30);

			txName.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			label13 = new Label(this, SWT.NONE);
			label13.setText("Kontak Person:");
			label13.setAlignment(SWT.RIGHT);

			label13.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label13.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtKontakPerson = new Text(this, SWT.BORDER);
			txtKontakPerson.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
					true, false, 1, 1));
			txtKontakPerson.setFont(SWTResourceManager.getFont("Tahoma", 10, 0,
					false, false));
			txtKontakPerson.setTextLimit(20);

			final Label label4 = new Label(this, SWT.NONE);
			label4.setText("Phone:");
			label4.setAlignment(SWT.RIGHT);

			label4.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label4.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));
			txtPhone = new Text(this, SWT.BORDER);
			GridData gd_txtPhone = new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1);
			gd_txtPhone.widthHint = 291;
			txtPhone.setLayoutData(gd_txtPhone);
			txtPhone.setTextLimit(30);

			txtPhone.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			label7 = new Label(this, SWT.NONE);
			label7.setText("Email:");
			label7.setAlignment(SWT.RIGHT);

			label7.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label7.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtEmail = new Text(this, SWT.BORDER);
			GridData gd_txtEmail = new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1);
			gd_txtEmail.widthHint = 299;
			txtEmail.setLayoutData(gd_txtEmail);
			txtEmail.setTextLimit(20);

			txtEmail.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			final Label label3 = new Label(this, SWT.NONE);
			label3.setText("Fax:");
			label3.setAlignment(SWT.RIGHT);

			label3.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label3.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtAccNo = new Text(this, SWT.BORDER);
			GridData gd_txtAccNo = new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1);
			gd_txtAccNo.widthHint = 308;
			txtAccNo.setLayoutData(gd_txtAccNo);
			txtAccNo.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));
			txtAccNo.setTextLimit(20);

			final Label label6 = new Label(this, SWT.NONE);
			label6.setText("Alamat:");
			label6.setAlignment(SWT.RIGHT);

			label6.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label6.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtAlamat = new Text(this, SWT.BORDER);
			txtAlamat.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1));
			txtAlamat.setTextLimit(100);

			txtAlamat.setFont(SWTResourceManager.getFont("Tahoma", 10, 0,
					false, false));

			label5 = new Label(this, SWT.NONE);
			label5.setText("Website:");
			label5.setAlignment(SWT.RIGHT);

			label5.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label5.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtWebsite = new Text(this, SWT.BORDER);
			txtWebsite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1));
			txtWebsite.setTextLimit(20);

			txtWebsite.setFont(SWTResourceManager.getFont("Tahoma", 10, 0,
					false, false));

			label8 = new Label(this, SWT.NONE);
			label8.setText("Saldo Hutang:");
			label8.setAlignment(SWT.RIGHT);

			label8.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label8.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtSaldoHutang = new AyBigDecimal(this, SWT.BORDER);
			GridData gd_txtSaldoHutang = new GridData(SWT.LEFT, SWT.CENTER,
					true, false, 1, 1);
			gd_txtSaldoHutang.widthHint = 241;
			txtSaldoHutang.setLayoutData(gd_txtSaldoHutang);
			txtSaldoHutang.setFont(SWTResourceManager.getFont("Tahoma", 10, 0,
					false, false));

			label11 = new Label(this, SWT.NONE);
			label11.setText("Nama Bank:");
			label11.setAlignment(SWT.RIGHT);

			label11.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label11.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtBankName = new Text(this, SWT.BORDER);
			txtBankName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1));
			txtBankName.setFont(SWTResourceManager.getFont("Tahoma", 10, 0,
					false, false));
			txtBankName.setTextLimit(20);

			label9 = new Label(this, SWT.NONE);
			label9.setText("No Rekening:");
			label9.setAlignment(SWT.RIGHT);

			label9.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label9.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtFax = new Text(this, SWT.BORDER);
			txtFax.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1));
			txtFax.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));
			txtFax.setTextLimit(30);

			label12 = new Label(this, SWT.NONE);
			label12.setText("Rek. Atas Nama:");
			label12.setAlignment(SWT.RIGHT);

			label12.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label12.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtAccName = new Text(this, SWT.BORDER);
			txtAccName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
					false, 1, 1));
			txtAccName.setFont(SWTResourceManager.getFont("Tahoma", 10, 0,
					false, false));
			txtAccName.setTextLimit(20);

			label10 = new Label(this, SWT.NONE);
			label10.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false,
					1, 1));
			label10.setText("Catatan:");
			label10.setAlignment(SWT.RIGHT);

			label10.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label10.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));

			txtCatatan = new Text(this, SWT.MULTI | SWT.WRAP | SWT.BORDER
					| SWT.V_SCROLL);
			GridData gd_txtCatatan = new GridData(SWT.FILL, SWT.FILL, true,
					false, 1, 1);
			gd_txtCatatan.heightHint = 89;
			txtCatatan.setLayoutData(gd_txtCatatan);

			this.layout();

		} catch (Exception e) {
			e.printStackTrace();
			LOG.info(e.getMessage());
			Util.showMsgBox("Gagal load: " + e.getMessage(), 1, getShell());
		}
	}
}
